//
//  PersonalUserPhotoViewController.m
//  ChatForHot
//
//  Created by wr on 2018/10/11.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "PersonalUserPhotoViewController.h"
#import "GroupSelectedView.h"
#import "PersonalUserVideorViewController.h"
#import "PersonalUserAlbumViewController.h"

@interface PersonalUserPhotoViewController () <GSViewDelegate>

@property (nonatomic, strong) GroupSelectedView *HOTCHATtitleview;
@property (nonatomic, strong) PersonalUserVideorViewController *HOTCHATvideoVC;
@property (nonatomic, strong) PersonalUserAlbumViewController *HOTCHATphotoVC;
@property (nonatomic, assign) PhotoType photoType;
@property (nonatomic, strong) NSMutableArray *uploadArray;
@property (nonatomic, assign) BOOL isUploading;
@property (nonatomic, assign) BOOL loadself;
@end

@implementation PersonalUserPhotoViewController

- (instancetype)initWithPhotoType:(PhotoType)photoType {
    if (self = [super init]) {
        self.photoType = photoType;
    }
    return self;
}

- (void)HOTCHATInsertSubViews {
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.HOTCHATvideoVC = [[PersonalUserVideorViewController alloc] initWithPhotoType:self.photoType];
    self.HOTCHATphotoVC = [[PersonalUserAlbumViewController alloc] initWithPhotoType:self.photoType];
    [self addChildViewController:self.HOTCHATvideoVC];
    [self addChildViewController:self.HOTCHATphotoVC];
    [self.view addSubview:self.HOTCHATvideoVC.view];
    [self.view addSubview:self.HOTCHATphotoVC.view];
    [self.view sendSubviewToBack:self.HOTCHATvideoVC.view];
    
    self.HOTCHATtitleview = [[GroupSelectedView alloc] init];
    self.HOTCHATtitleview.HOTCHATmidSpace = 15;
    self.HOTCHATtitleview.delegate = self;
    self.HOTCHATtitleview.frame = CGRectMake(0, 0, 200, 40);
    self.HOTCHATtitleview.HOTCHATleftTitle = NSLocalizedString(@"selGp1", nil);
    self.HOTCHATtitleview.HOTCHATrightTitle = NSLocalizedString(@"selGp2", nil);
    self.navigationItem.titleView = self.HOTCHATtitleview;
}

- (void)HOTCHATsetNavigationItemsIsInEditMode:(BOOL)isInEditMode animated:(BOOL)animated {
    [super HOTCHATsetNavigationItemsIsInEditMode:isInEditMode animated:animated];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"backBtnImg"] style:UIBarButtonItemStylePlain target:self action:@selector(HOTCHATbackClcik)];
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    [self.HOTCHATphotoVC.view mas_updateConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
        
    }];
    [self.HOTCHATvideoVC.view mas_updateConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.HOTCHATphotoVC.view);
    }];
}

#pragma mark -selectedalbumActions

- (void)HOTCHATSelectedViewWithIndex:(NSInteger)index {
    if (index == 1) {
        [self.view bringSubviewToFront:self.HOTCHATphotoVC.view];
    }else{
        [self.view bringSubviewToFront:self.HOTCHATvideoVC.view];
    }
}

@end
